class Count {
    constructor(elem) {
        this.elem = elem;
        this.countElem = this.elem.find('span');
        this.count = Number(this.countElem.text());
        this.pushElem = this.elem.find('.icon-jia');
        this.reduceElem = this.elem.find('.icon-jian');

        this.bindEvent();
    }
    push () {
        this.count++;
        this.resetCount();
    }
    reduce () {
        if (this.count > 1) {
            this.count--;
            this.resetCount();
        }
    }
    resetCount () {
        this.countElem.text(this.count);
    }
    bindEvent () {
        this.pushElem.on('click' , this.push.bind(this));
        this.reduceElem.on('click', this.reduce.bind(this));
    }
}
